//
//  pictureCollectionViewCell.m
//  Recycling
//
//  Created by jzd on 2018/5/21.
//  Copyright © 2018年 宋佳. All rights reserved.
//

#import "pictureCollectionViewCell.h"

@interface pictureCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *backImg;
@property (weak, nonatomic) IBOutlet UIButton *delegateBut;
@property (weak, nonatomic) IBOutlet UIButton *addBut;
@property (weak, nonatomic) IBOutlet UIImageView *dataImg;


@end
@implementation pictureCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.delegateBut.layer.cornerRadius = 10;
    self.delegateBut.layer.masksToBounds = YES;
    self.addBut.layer.borderColor = [UIColor blackColor].CGColor;
    self.addBut.layer.borderWidth = 1.0;
}
-(void)setImg:(UIImage *)img{
    if (img == nil) {
        [self.backImg setImage:[UIImage imageNamed:@"icon_add"]];
        self.addBut.userInteractionEnabled = YES;
        self.delegateBut.hidden = YES;
    }else{
        self.backImg.image = img;
        self.addBut.userInteractionEnabled = NO;
        self.delegateBut.hidden = NO;
    }
}
- (IBAction)addPicture:(UIButton *)sender {
    [[NSNotificationCenter defaultCenter]postNotificationName:addPictureNotification object:nil];
}
- (IBAction)removePic:(UIButton *)sender {
    [[NSNotificationCenter defaultCenter]postNotificationName:delegatePicNotification object:self.dataImg.image];
}

@end
